package meituan;

import java.util.Scanner;

/**
 * @author le
 */
public class Meituan4
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        double m = in.nextDouble();
        double w = in.nextDouble();
        int len = in.nextInt();

        double[][] action = new double[len][2];
        // 状态数组 用来存储每次的状态
        double[][] dp = new double[len][2];
        int index = 0;
        for (int i = 0;i < len;i++){
            if (in.nextLine().equals("A")){
                System.out.println("进来了");
                action[index][0] = in.nextDouble();
                action[index][1] = in.nextDouble();
                index++;
            }
        }

        for(int i = 0;i < action.length;i++){
            if (action[i][0] != 0){
                // 求出溶质的质量
                w = m*w+action[i][0]*action[i][1];
                // 求出溶液的总质量
                m = m+action[i][0];
                // 当前溶质的值
                w = w/m;
                System.out.println(m+" "+w);
            }
        }

        in.close();
    }
}
